1 using UnityEngine;
2 using
System.Collections;
3
4 namespace
GamePlay
5 {
6     
public class PurposeLabel : MonoBehaviour
7     {
8         
public GameObject purposeLabel1;
9         
public GameObject purposeLabel2;
10         
public GameObject purposeLabel3;
11
12         
public Sprite starSprite;
13         
public GameObject[] stars;
14
15         
// Use this for initialization
16         
void Start()
17         {
18             BitmapFont purposeFont1 =
new BitmapFont("Fonts/shop_font", "Fonts/shop_font_xml", purposeLabel1);
19             BitmapFont purposeFont2 =
new BitmapFont(purposeFont1, purposeLabel2);
20             BitmapFont purposeFont3 =
new BitmapFont(purposeFont1, purposeLabel3);
21
22             purposeFont1.setText(
"5th place or better : 50 #", 0, 12, "GUI", "GUI");
23             purposeFont2.setText(
"3rd place or better : 100 #", 0, 12, "GUI", "GUI");
24             purposeFont3.setText(
"1st place : 200 #", 0, 12, "GUI", "GUI");
25
26             purposeLabel1.transform.localScale =
new Vector3(0.8f, 0.8f, purposeLabel1.transform.localScale.z);
27             purposeLabel2.transform.localScale =
new Vector3(0.8f, 0.8f, purposeLabel2.transform.localScale.z);
28             purposeLabel3.transform.localScale =
new Vector3(0.8f, 0.8f, purposeLabel3.transform.localScale.z);
29
30             
int star = Data.getData(Data.KEY_STAR + (Attr.currentWorld * 15 + Attr.currentLevel));
31             
for (int i = 0; i < 3; i++)
32             {
33                 
if (i < star)
34                 {
35                     stars[i].GetComponent<SpriteRenderer>().sprite = starSprite;
36                 }
37             }
38
39         }
40
41         
void Update()
42         {
43
44         }
45     }
46 }


Use this for initialization




Trò chơi đua xe động vật trong UNITY Engine 114.632 lượt xem

Gõ tìm kiếm nhanh...